<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定时刷新图片</title>
    <style>
        img{
            display: none;
            width: 100%;
        }
        .cropbox{
            height: 2500px;
            overflow: hidden;
        }
        .active{
            display: block;
        }
    </style>
</head>
<body>
    <div class="cropbox">
        <img src="./photo1.jpg" class="active">
        <img src="./photo2.jpg">
        <img src="./photo3.jpg">
    </div>
    <script>
        var imgs = document.querySelectorAll('img');
        setInterval(function(){
            for(var i = 0;i < imgs.length;i++){
                if(imgs[i].getAttribute('class') == 'active'){
                    imgs[i].className = '';
                    imgs[(i+1)%3].className = 'active';
                    break;
                }
            }
        },3000);
    </script>
</body>
</html>